// componnets/navigateBar.js
import store from '../../modules/store'
Component({

  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    currentPageIndex: -1,
    status: 1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleLongPress() {
      store.setItem('showDeveloperInfo', true)
      setTimeout(() => {
        store.removeItem('showDeveloperInfo')
      }, 3000);
    },
    handleChange(e) {
      store.setItem('mainCurrentPageIndex', e.currentTarget.dataset.index)
    }
  },

  created() {
    let data = store.getItem('mainCurrentPageIndex')
    this.setData({
      currentPageIndex: data
    })
    store.onChange('mainCurrentPageIndex', (e) => {
      let data = store.getItem('mainCurrentPageIndex')
      this.setData({
        currentPageIndex: data
      })
    })
    store.onChange('navigateBarStatus', () => {
      this.setData({
        status: store.getItem('navigateBarStatus')
      })
    })
  }
})